#ifndef EEPROM_H
#define EEPROM_H

/**
 * @defgroup nxbot_eeprom EEPROM Library
 * @ingroup nxbot_low_level
 * @code #include <eeprom.h> @endcode
 * @brief Eeprom library for saving long-term variables of NXBOT. 
 *
 * This module uses the on-chip eeprom memory of the ATmega1281 microcontroller. It is used to store configuration parameters, such as
 * the PID values for the velocity loop, the number of sonars being conected to NXBOT, among others.
 */
 
/**@{*/

/**
 * @brief Constant for saving TI parameter in EEPROM
 * @see eeprom_writePIDParam
 *
 */
#define PID_TI 0

/**
 * @brief Constant for saving TD parameter in EEPROM
 * @see eeprom_writePIDParam
 *
 */
#define PID_TD 1

/**
 * @brief Constant for saving KP parameter in EEPROM
 * @see eeprom_writePIDParam
 *
 */
#define PID_KP 2

/**
 * @brief Hardware initialization for the %eeprom module.
 *
 * ffgadgfdsds.
 */
void eeprom_init(void);

/**
 * @brief Function used to write any of the three parameters of the PID velocity controller: TI, TD and KP.
 *
 * Use one of the following constants to save the value of each parameter: PID_TI, PID_TD, PID_KP.
 *
 * @param PIDparam One of three values: 
 *                         - \b PID_TI 
 *                              <br> The value of the Integration module of the controller.
 *                         - \b PID_TD
 *                              <br> The value of the Derivative module of the controller.
 *                         - \b PID_KP
 *                              <br> The value of the Proportional module of the controller.
 *
 * @param value The floating value of the selected parameter. 
 */
void eeprom_writePIDParam(unsigned char PIDparam, float value);

/**
 * @brief Function used to save the number of sonars used by NXBOT.
 *
 * 
 *
 * @param sonarCount The number of sonars.
 */
void eeprom_writeSonarCount(unsigned char sonarCount);



float eeprom_readPIDParam(unsigned char PIDparam);

unsigned char eeprom_readSonarCount(void);
/**@}*/
#endif
